﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections;
using UtilsORM.MySqlData;
using UtilsORM;

namespace ServiceWeb.WebAdmin
{
    public class ServiceSystemMenu
    {
        public DataTable GetList(Guid Menu_Parent, MagerLoginInfo magerLoginInfo)
        {

            string sqlwhere = " and rm_r_guid='" + magerLoginInfo.r_guid + "'";
            if (Menu_Parent == Guid.Empty)
            {
                sqlwhere += " and menu_parent = menu_guid ";
            }
            else
            {
                sqlwhere += " and menu_parent != menu_Guid and Menu_Parent='" + Menu_Parent + "' ";
            }
            string sql = "select distinct menu_Order,menu_Guid,menu_parent,menu_Name,menu_LinkUrl,menu_type,menu_iconCss,menu_index from bs_manage_system_menu inner join bs_manage_role_menu on rm_menu_Guid=menu_guid  where menu_status=0 and menu_type=0 " + sqlwhere + " order by menu_Order ";
            DataTable dt = MySqlYihongIot.GetDataTable(sql);
            return dt;
        }
        public string GetMenuName(string Menu_Guid)
        {

            return new EFYihongIotContext().bs_manage_system_menu.Where(c => c.menu_guid == Menu_Guid && c.menu_status == 0).Select(c => c.menu_name).FirstOrDefault();

        }

    }
}
